define("pages/jls_tx/txwsbd", [
        "../../plugins/easyui/jquery-easyui-1.5.1/jquery.easyui.min.js",
        "../../plugins/easyui/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js",
        "../../upload",
        "../../common/componts.js",
        "../../common/kss.js",
    ],
    function(require) {
        var comonts=require("../../common/componts");
        var kss=require("../../common/kss");
        var wsbdjbxxid="wsbdjbxxId";
        var selectid;
        var id;
        var Select = function(){
            comonts.initSelectPage(undefined);
            comonts.initSelect(undefined,undefined,undefined);
        }
        var tableInitdd=function(){
            comonts.initTable(wsbdjbxxid,{
                url:"/jls_jbxx/jbxxList",
                title:'',
                /*width:'98.5%',*/
                fit:true,
                tools:'#wsbdyc',
                columns :  [
                    {
                        field: 'oid',
                        title: '序号',
                        formatter: function(value, rowData, rowIndex){
                            return '<input type="radio" name="ryRadio" id="ryRadio' + rowIndex + '" value="' + rowData.oid + '" />';
                        }},
                        {field : 'xm',title : '姓名',width : 80,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.xbString==null?"":row.xbString)+'>'+(row.xbString==null?"":row.xbString)+'</span>'}},
                    {field : 'xbString',title : '性别',width : 80,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.xbString==null?"":row.xbString)+'>'+(row.xbString==null?"":row.xbString)+'</span>'}},
                    {field : 'hjszd',title : '户籍所在地',width : 80,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.xbString==null?"":row.xbString)+'>'+(row.xbString==null?"":row.xbString)+'</span>'}},

                    {field : 'csrq',title : '出生日期',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.rssj==null?"":row.rssj)+'>'+(row.rssj==null?"":row.rssj)+'</span>'}},
                    {field : 'ab',title : '案别',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.csrq==null?"":row.csrq)+'>'+(row.csrq==null?"":row.csrq)+'</span>'}},
                    {field : 'ryjb',title : '人员级别',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.csyy==null?"":row.csyy)+'>'+(row.csyy==null?"":row.csyy)+'</span>'}},
                    {field : 'jsh',title : '拘室号',width : 110,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.jlzxqxz==null?"":row.jlzxqxz)+'>'+(row.jlzxqxz==null?"":row.jlzxqxz)+'</span>'}},
                    {field:'operate',title:'详细信息',align:'center',width : 150,/*width:$(this).width()*0.15,*/
                        formatter:function(value, row, index){
                            var str = '<a href="#" data-target="#ckPhoto"  name="opera" data-toggle="modal" class="easyui-linkbutton"><img src="../../img/xq.png"></a>';
                            return str;
                            //return  '<button id="sh_add" onclick="add"  > 不通过</button>'
                        }
                    }
                ] ,
                //基本信息双击事件
                onDblClickRow:function(rowIndex, rowData){
                    $("input[name='ryRadio']")[rowIndex].checked = true;
                    $("#"+wsbdjbxxid).datagrid("selectRow", rowIndex);
                    selectid=rowData.id;
                },

                onLoadSuccess:function(data){
                    if(data.total>0){
                        $('#'+wsbdjbxxid).datagrid("selectRow", 0);
                        $("input[name='ryRadio']")[0].checked = true;
                    }
                    $("a[name='opera']").on('click',function(){
                        var jbxx = $('#'+wsbdjbxxid).datagrid("getSelected");
                        kss.initJbxxxx(jbxx.gcbh,jbxx.rybh,jbxx.xm+"--详细信息");
                    });
                },
                //单击行选中取消事件
                onClickRow:function(rowIndex, rowData){
                    if(selectid!=rowData.id){
                        $("input[name='ryRadio']")[rowIndex].checked = true;
                        selectid=rowData.id;
                    }else{
                        $("#"+wsbdjbxxid).datagrid("unselectRow",rowIndex);
                        $("input[name='ryRadio']")[rowIndex].checked = false;
                        $('#'+wsbdjbxxid).datagrid('clearSelections');
                        selectid="";
                    }
                    kss.zjryClick(rowData);
                },
                onSelect:function(rowIndex, rowData){
                },
                rightmenu:function(){
                    //kss.initJbxxRightMenu(jbxxrightmenuid);
                },
            });
            //页面高度自适应
            $('#'+wsbdjbxxid).datagrid('resize',{
                height:($(window).height()-150),
            });
        }
        var findJbxx=function(){
            var xm = $("#wsbd_xm").text('getValue');
            $('#'+wsbdjbxxid).datagrid('clearSelections');
            $('#'+wsbdjbxxid).datagrid('load',{
            });
        }


        var bindAction=function(){

            $("#tqjc_query").on("click",function(){
                findJbxx();
            });


            $(window).keydown(function(event) {
                if (event.keyCode == 13) {
                    findJbxx();
                }
            });

        }
        var initView=function(){
            tableInitdd();
            bindAction();
            Select();

        }
        initView();
    });

